class AddArticlePublishedAt < ActiveRecord::Migration
  def self.up
    Article.transaction do
      add_column :articles, :published_at, :datetime
      
      Article.find(:all).each do |article|
        article.published_at = article.created_at
        article.save!
      end
    end
  end

  def self.down
    remove_column :articles, :published_at
  end
end
